<?php $this->_extends('_layouts/default_layout'); ?>
<?php echo $this->_block('title')?>
<?php echo '会员中心推荐赚钱',$config['sitename'] ?>
<?php echo $this->_endblock()?>
<?php echo $this->_block('meta')?>
<link rel="stylesheet"
	type="text/css" href="<?php echo $_BASE_DIR; ?>css/global.css" />
<link rel="stylesheet"
	href="<?php echo $_BASE_DIR; ?>images/account_con.css" type="text/css">
	
	<script type="text/javascript" src="<?php echo $_BASE_DIR?>javascripts/jquery.min.js"></script>
<?php echo $this->_endblock()?>
<?php $this->_block('center'); ?>
<div>
	<img src="<?php echo $_BASE_DIR; ?>images/account_con_03.jpg">
</div>
<div id="maincon_c">
<?php $this->_element('userleft') ?>
	<div id="maincon_c_r">
			
				<div id="pwd_protect_title">
				<h3>卡密充值</h3>
				</div>
				<hr>
				<p id="p_step1">您的现金余额:<font color="red"><span id="usermoney"><?php echo $userdata->usermoney;?></span></font>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red"><span id="send_err"></span></font></p>
				
			
			<div id="msg"></div>
			<div id="step1">
				
				<div class="clear"></div>
				
				
				<form onsubmit="cardpay();return false;">
					<table class="getbind_table" border="0" cellpadding="0" cellspacing="0">
						
						<tbody>
						<tr>
							<td style="text-align: right;"><strong>充值账号：</strong></td>
							<td><input name="userphone" id="userphone" value="<?php echo $userdata->userphone?>" maxlength="20" class="getback" type="text"></td>
							<td></td>
						</tr>
						
						<tr>
							<td style="text-align: right;"><strong>充值卡卡号：</strong></td>
							<td><input name="code" id="code" maxlength="20" class="getback" type="text"></td>
							<td></td>
						</tr>
						<tr>
							<td style="text-align: right;"><strong>充值卡密码：</strong></td>
							<td><input name="pass" id="pass" maxlength="20" class="getback" type="text"></td>
							<td></td>
						</tr>
					</tbody></table>
					<div class="clear"></div>
					<br>
					<div id="account_vouch_btnzone">
						<input  id="next" value="确认充值" type="submit">
					</div>
					
				</form>
				
			</div>
			
			
				<br>
				<hr><br>
				<strong>充值介绍：</strong><br>
				<p>每张充值卡都有到期时间和面值,请确认输入正确的卡密信息,并且在限期内使用！</p>
				
			</div>
			<div class="clear"></div>
</div>

<div style="margin-bottom: 10px;">
	<img src="<?php echo $_BASE_DIR; ?>images/account_con_15.jpg">
</div>
<script>
function cardpay()
{
	var userphone = document.getElementById('userphone');
	var code = document.getElementById('code');
	var pass = document.getElementById('pass');
	var send_err = document.getElementById('send_err');
	if(userphone.value == '')
	{
		send_err.innerHTML= '您必须输入要充值的手机号';
		userphone.focus();
		}else if (code.value == '')
		{
		send_err.innerHTML='您必须输入充值卡的卡号';
		code.focus();
		}else if(pass.value == '')
		{
			send_err.innerHTML = '您必须输入要赠送的积分';
			pass.focus();
			}else if(confirm('请确认充值信息\n充值账号:'+userphone.value+'\n卡号 :' + code.value + '\n密码:' + pass.value + ''))				
			{
				$.post(
						'<?php echo url("users/cardpay")?>',
						'userphone='+userphone.value+'&'+'code='+code.value+'&pass='+pass.value,
						function(data){
							if(data.status)
							{
								alert('充值成功,'+userphone.value+' 当前的余额为:'+data.result);
								$('#usermoney').html(data.result);
								
								}else
								{
								alert(data.message);
									}
							},
						'json'
						);
				}
	}
</script>
<?php $this->_endblock(); ?>
